package com.designpattern.creating.singleton;

/**
 * @Author chengzelee
 * @Date 2022/11/24 18:31
 * @Desc 内部类实现单例
 *       内部类在首次被调用时加载
 *       jvm保证构造方法的线程安全，从而实现线程安全的懒汉单例
 */
public class Singleton_insideClass {

    private static class SingletonHolder{
        private static Singleton_insideClass instance = new Singleton_insideClass();
    }

    public static Singleton_insideClass getInstance(){
        return SingletonHolder.instance;
    }
}
